# -*- coding: utf-8 -*-
"""
Created on Wed Aug  7 11:47:07 2024

@author: 11426
"""

import pandas as pd
import os 
import matplotlib.pyplot as plt
os.chdir(r'F:\workdoc\工作盘\工作相关6\小微绿色主体评价2\过往分数对比')

df24 = pd.read_excel('./result.xlsx',sheet_name='2024').rename(columns = {'score':'score24'})
df_old = pd.read_excel('./result.xlsx',sheet_name='old').rename(columns = {'score':'score_old'})
df21 = pd.read_excel('./result.xlsx',sheet_name='2021').rename(columns = {'score':'score21'})
#%%

plt.figure(figsize=(10, 6)) 
df24.score.plot(kind='hist',bins=100)
plt.figure(figsize=(10, 6)) 
df_old.score.plot(kind = 'hist',bins=100)
plt.figure(figsize=(10, 6)) 
df21.score.plot(kind='hist',bins=100)
#%%



all_df = pd.merge(df24,df_old,on = 'pjuuid')
temp = all_df[['pjuuid','model_type','score24','score_old']]

result = pd.merge(temp,df21[['pjuuid','score21']],on='pjuuid')


#%%

a = df24.groupby(['model_type']).score24.quantile([0.9,0.7,0.3]).unstack()
a.columns = ['q1','q2','q3']

a.to_excel('./config_table.xlsx')


